package org.game.module.elementcollectbo;

import com.sojoys.artifact.exception.AbstractLogicModelException;
import com.sojoys.artifact.factory.session.ISession;
import org.game.constant.SessionConstent;
import org.game.db.bean.ElementCollection;
import org.game.db.bean.Player;
import org.game.msgBuilder.ElementCollectMsgBuilder;
import org.game.protobuf.c2s.C2SElementCollectMsg;
import org.game.util.ProtoUnit;

/**
 * 元素收集（图鉴）
 * Created by fxf on 2018-3-1.
 */
public class ElementCollectBOImpl implements ElementCollectBO {
    @Override
    public byte[] getAllElement(ISession session, C2SElementCollectMsg.GetAllElement msg) throws AbstractLogicModelException {
        Player player = session.getAttr(SessionConstent.PLAYER);
        ElementCollection ec = player.getElementCollectionsFkPlayerId();
        return ProtoUnit.toByte(ElementCollectMsgBuilder.buildGetAllElementMsg(ec));
    }
}
